Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

413
Visualizações
Error: Message content must be a non-empty string. || if (typeof data !== 'string') throw new error(errorMessage);

Hi i have problem with using guild on my discord bot. Whenever i want to return the amount of the users on my server i recive this error

if (typeof data !== 'string') throw new error(errorMessage);

RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.

if (cmd === `name`) { //This is working when used on discord text-channel
        msg.reply(msg.guild.name)
    }
    if (cmd === `users`) {  //This is not working when used on discord text-channel
        msg.reply(msg.guild.memberCount)
    }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The memberCount property returns a number which you are trying to send in a channel. The problem is that sending a number is not allowed. Your message content must always be a string.

You can solve this problem by using the String function to send a number. Your command will look like this:

if(cmd === `users`){
    msg.reply(String(msg.guild.memberCount));
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda